package net.hn.hnms.biz.material.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.hn.hnms.sys.common.core.domain.R;
import net.hn.hnms.sys.common.core.domain.ResponsePage;
import net.hn.hnms.sys.common.mybatis.core.page.PageQuery;
import net.hn.hnms.sys.common.satoken.config.AutoSetMineCode;
import net.hn.hnms.biz.material.request.*;
import net.hn.hnms.biz.material.service.*;
import net.hn.hnms.biz.material.vo.*;
import net.hn.hnms.biz.material.request.*;
import net.hn.hnms.biz.material.service.*;
import net.hn.hnms.biz.material.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "年度采购计划", tags = {"年度采购计划"})
@RestController
@RequestMapping("/")
public class MaterialQueryController {


    @Autowired
    private IPurchasePlanService purchasePlanService;
    @Autowired
    private IStockInService stockInService;
    @Autowired
    private IStockOutService stockOutService;
    @Autowired
    private IStockInfoService stockInfoService;
    @Autowired
    private IMaterialRecordService materialRecordService;

    @ApiOperation("采购计划分页查询")
    @GetMapping("/purchase/plan/page")
    @AutoSetMineCode
    public R<ResponsePage<PurchasePlanVO>> purchasePlanPage(PurchasePlanReq req, PageQuery pageQuery){
        return R.ok(purchasePlanService.page(req,pageQuery));
    }

    @ApiOperation("入库信息分页查询")
//    @SaCheckPermission("dispatch:keepwatch:add")
    @GetMapping("/stockIn/page")
    @AutoSetMineCode
    public R<ResponsePage<StockInVO>> stockInPage(StockInReq req, PageQuery pageQuery){
        return R.ok(stockInService.page(req,pageQuery));
    }


    @ApiOperation("出库信息分页查询")
//    @SaCheckPermission("dispatch:keepwatch:add")
    @GetMapping("/stockOut/page")
    @AutoSetMineCode
    public R<ResponsePage<StockOutVO>> stockOutPage(StockOutReq req, PageQuery pageQuery){
        return R.ok(stockOutService.page(req,pageQuery));
    }

    @ApiOperation("物资台账信息分页查询")
//    @SaCheckPermission("dispatch:keepwatch:add")
    @GetMapping("/ledger/page")
    @AutoSetMineCode
    public R<ResponsePage<MaterialRecordVO>> ledgerPage(MaterialRecordReq req, PageQuery pageQuery){
        return R.ok(materialRecordService.page(req,pageQuery));
    }


    @ApiOperation("库存信息分页查询")
//    @SaCheckPermission("dispatch:keepwatch:add")
    @GetMapping("/stock/page")
    @AutoSetMineCode
    public R<ResponsePage<StockInfoVO>> stockPage(StockInfoReq req, PageQuery pageQuery){
        return R.ok(stockInfoService.page(req,pageQuery));
    }
}
